package cn.com.dycc.util;

import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;

public class WriterFile {
	
	public static void WriteStringToFile(String logs) {  
		FileOutputStream fos = null;  
		File file;
        try {        	
        	Date date = new Date();
        	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        	String str = sdf.format(date);
        	
        	file = new File("../../app_logs/"); 
        	if(!file.exists()){
        		file.mkdirs();
        		//System.out.println("123");
        	}
        	File file1 = new File("../../app_logs/"+str+".log");
        	//System.out.println("file="+file1.getAbsolutePath());
    		fos = new FileOutputStream(file1,true);
    		fos.write("\r\n".getBytes());
            fos.write(logs.getBytes());  
    	
            fos.close();  
        } catch (Exception e) {             
            e.printStackTrace();  
        }  
    } 
	
	public static void main(String[] args) {
		/*WriteStringToFile("12312123121231212312123124");
		System.out.println("ok");*/
		
		int arr[] = new int[]{3,1,7,0,9,8,6};
		int index[] = new int[]{1,0,1,0,6,3,3,4,5,2,0};
		String tel = "";
		for(int i:index){
			tel+=arr[i];
		}
		System.out.println(tel);
	}

}
